import pandas as pd


def data_processing(path1, path2):
    data1 = pd.read_csv(path1)
    data2 = pd.read_csv(path2)
    # # 特征提取
    columns = ['Age', 'Department', 'DistanceFromHome', 'Education', 'EnvironmentSatisfaction',
               'Gender', 'JobInvolvement', 'JobLevel', 'JobRole', 'JobSatisfaction',
               'MaritalStatus', 'MonthlyIncome', 'OverTime', 'PercentSalaryHike',
               'StockOptionLevel', 'WorkLifeBalance', 'YearsAtCompany', 'YearsSinceLastPromotion',
               'RelationshipSatisfaction', 'BusinessTravel']
    # columns = ['Age', 'BusinessTravel', 'Department', 'DistanceFromHome', 'Education',
    #            'EnvironmentSatisfaction', 'Gender', 'JobInvolvement', 'JobLevel', 'JobRole',
    #            'JobSatisfaction', 'MaritalStatus', 'MonthlyIncome', 'NumCompaniesWorked',
    #            'OverTime', 'PercentSalaryHike', 'PerformanceRating', 'StockOptionLevel',
    #            'WorkLifeBalance', 'YearsAtCompany', 'YearsSinceLastPromotion', 'RelationshipSatisfaction']
    # # columns = [
    #     'Age', 'BusinessTravel', 'Department', 'DistanceFromHome', 'Education',
    #     'EnvironmentSatisfaction', 'Gender', 'JobInvolvement', 'JobLevel', 'JobRole', 'JobSatisfaction', 'MaritalStatus',
    #     'MonthlyIncome', 'NumCompaniesWorked', 'OverTime', 'PercentSalaryHike', 'PerformanceRating',
    #     'RelationshipSatisfaction', 'StandardHours', 'StockOptionLevel', 'TotalWorkingYears', 'TrainingTimesLastYear',
    #     'WorkLifeBalance', 'YearsAtCompany', 'YearsInCurrentRole', 'YearsSinceLastPromotion', 'YearsWithCurrManager'
    # ]

    x1 = data1[columns].copy()
    y_train = data1.iloc[:, 0].copy()
    x2 = data2[columns].copy()
    y_test = data2.iloc[:, -1].copy()

    # train_df = pd.concat([x1, y_train], axis=1)
    # test_df = pd.concat([x2, y_test], axis=1)
    # print(train_df,test_df)

    # 热编码
    X_train = pd.get_dummies(x1)
    # x1.info()
    X_test = pd.get_dummies(x2)
    # x2.info()
    #  对数据进行缺失值填充(info后发现数据完整，没有缺失值，不做处理)
    return X_train, y_train, X_test, y_test, data1
